package tiruvury.InterviewPrep.HelperClasses;

import java.util.Iterator;
import java.util.List;

// ITERATOR PART 3: THE ITERATOR HIMSELF!
public class MenuIterator implements Iterator<MenuItem>
{
	private List<MenuItem> menu = null;
	private int idx = 0;

	public MenuIterator(List<MenuItem> menu)
	{
		this.menu = menu;
	}

	public boolean hasNext()
	{
		return (idx < this.menu.size());
	}

	public MenuItem next()
	{
		MenuItem itm = null;

		if (hasNext())
		{
			itm = this.menu.get(idx);
			idx++;
		}

		return itm;
	}

	public void remove()
	{

	}

}
